/**
 * Copyright 2018 asiainfo Inc.
 **/
package com.myz.rabbitmq.common.config;

/**
 * rabbitmq 常量
 *
 * @author maoyz on 2018/8/29
 * @version: v1.0
 */
public abstract class RabbitMqConstant {

    public static class ExchangeDef {
        public static final String CONTRACT_FANOUT = "contract_fanout";
        public static final String CONTRACT_TOPIC = "contract_topic";
        public static final String CONTRACT_DIRECT = "contract_direct";
    }

    public static class QueueDef {
        public static final String FIRST_QUEUE = "first_queue";
        public static final String TOPIC_QUEUE1 = "topic_queue_1";
        public static final String TOPIC_QUEUE2 = "topic_queue_2";
    }

    public static class RoutingKeyDef {
        public static final String FIRST_QUEUE = "first_queue";
        public static final String TOPIC_QUEUE1 = "topic_queue_1";
        public static final String TOPIC_QUEUE2 = "topic_queue_2";
    }

    /**
     * 交换机
     */
    public enum ExchangeEnum {
        CONTRACT_FANOUT(ExchangeDef.CONTRACT_FANOUT, "消息分发"),
        CONTRACT_TOPIC(ExchangeDef.CONTRACT_TOPIC, "消息订阅"),
        CONTRACT_DIRECT(ExchangeDef.CONTRACT_DIRECT, "点对点");

        private final String code;
        private final String name;

        ExchangeEnum(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }


    /**
     * 队列名称
     */
    public enum QueueName {
        FIRST_QUEUE(QueueDef.FIRST_QUEUE, "first_queue"),
        TOPIC_QUEUE1(QueueDef.TOPIC_QUEUE1, "topic_queue_1"),
        TOPIC_QUEUE2(QueueDef.TOPIC_QUEUE2, "topic_queue_2");

        private final String code;
        private final String name;

        QueueName(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

    }

    public enum RoutingKeyEnum {
        DIRECT_QUEUE_KEY("queue_one_key", "测试队列key"),
        TOPIC_QUEUE_KEY_1("*.topic.*", "topic测试队列key"),
        TOPIC_QUEUE_KEY_2("lazy.#", "topic测试队列key");

        private final String code;
        private final String name;

        RoutingKeyEnum(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
}
